import upyun


class Myupy:
    def __init__(self):
        #                           服务名称               账号                         密码
        self.up = upyun.UpYun("image-zhc", "zhanghaocheng", "GjWiLo0wbvFXtuQ8Z8rpnxPV27Lddp4M")

    # 上传文件
    def upload(self, upload_dir, file, userid):
        with open(upload_dir , 'rb') as f:
            self.up.put('/' + str(userid) + '/' + file, f)


myup = Myupy()
myup.upload('D:/Flask/p6_education/static/upload/1/9f2187d92ffc4aa1912125b7d065fdf4.jpg',
            '9f2187d92ffc4aa1912125b7d065fdf4.jpg',1)



